#!/bin/bash


# =================================
# Create and move to home directory
# =================================
mkdir ~/selenium
cd ~/selenium

# =============================================
# Update repositories and install prerequisites
# =============================================
sudo apt-get update
sudo apt-get install sun-java6-jdk ant ant-optional


# ==============================
# Fetch Selenium Grid and unpack
# ==============================
### TODO: make fetch script scrape the download page for latest download
###       http://selenium-grid.seleniumhq.org/download.html
wget -O - http://release.seleniumhq.org/selenium-grid/selenium-grid-1.0.4-bin.tar.bz2 | tar -xvjf -



# ====================================
# Enter directory and run sanity check
# ====================================
cd selenium-1.0.4
ant sanity-check


# install Flash
sudo apt-get install flashplugin-nonfree


# ===========================
# Install additional browsers
# ===========================

cd ~

# --- Konqueror ---

# sudo apt-get install konqueror



# --- Opera ----
### TODO: Check for existing repository, add if necessary

# echo "deb http://deb.opera.com/opera/ stable non-free" >> /etc/apt/sources.list
# sudo apt-get install debian-archive-keyring
# wget -O - http://deb.opera.com/archive.key | sudo apt-key add -
# sudo apt-get update
# sudo apt-get install libqt3-mt opera